package java56_5;

import java.util.Scanner;

public class ScoreStat3 {

	public static void main(String[] args) {
		// 录入5门课成绩，求平均成绩；如果录入是负数，停止并提示错误
		Scanner sc = new Scanner(System.in);
		double sum = 0, avg, score;
		System.out.println("请输入5门课成绩：");
		for (int i = 1; i <= 5; i++) {
			score = sc.nextDouble();
			if (score < 0) {
				System.out.println("您输入错误，不能小于0");
				return;
				// break;
			}
			sum += score;
		}
		avg = sum / 5;
		System.out.println("平均分是" + avg + "分");

	}
}
